//
//  RYCHTTPRequest.m
//  RaiyiCommon
//
//  Created by zhiwei ma on 12-4-25.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "RYCHTTPRequest.h"
#import "ASIDownloadCache.h"

@implementation RYCHTTPRequest
- (id)initWithURL:(NSURL *)newURL
{
    self = [super initWithURL:newURL];
    if (self)
    {
        self.downloadCache = [ASIDownloadCache sharedCache];
        self.timeOutSeconds = 15;
    }
    return self;
}
@end

@implementation ASIHTTPRequest (RYCCategory)
- (void)clearCache
{
    [self.downloadCache clearCachedResponsesForStoragePolicy:self.cacheStoragePolicy];
}

- (void)setDefaultCacheConfig
{
//    self.downloadCache = [ASIDownloadCache sharedCache];
//    self.cachePolicy = ASIAskServerIfModifiedCachePolicy | ASIFallbackToCacheIfLoadFailsCachePolicy;
    self.cacheStoragePolicy = ASICachePermanentlyCacheStoragePolicy;
    self.secondsToCache = 60*60*24*7;
}

- (void)setSessionCacheConfig
{
    self.secondsToCache = 60*60*24;
    self.cacheStoragePolicy = ASICacheForSessionDurationCacheStoragePolicy;
}
@end

@implementation RYCFormDataRequest
@end